<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>

    <!--在线引用JQuery-->
    <script src="https://code.jquery.com/jquery-3.1.1.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
          integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css"
          integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
            integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd"
            crossorigin="anonymous"></script>

    <!--首页风车Logo-->
    <style>

        * {
            margin: 0;
            padding: 0;
        }

        .main {
            width: 804px;
            height: 804px;
            animation: roll 20000ms linear infinite;
            margin: auto;
        }

        @keyframes roll {
            0% {
                transform: rotate(0deg);
            }
            100% {
                transform: rotate(-360deg);
            }
        }

        .white_circle {
            z-index: 99;
            position: absolute;
            width: 50px;
            height: 50px;
            border-radius: 50px;
            background-color: white;
            margin: 377px 0 0 377px;
        }

        .fla {
            position: absolute;
            width: 402px;
            height: 180px;
        }

        .fla_one {
            transform: rotate(270deg);
            margin: 108px 0px 0px 121px;
        }

        .fla_two {
            transform: rotate(180deg);
            margin-top: 389px;
        }

        .fla_three {
            transform: rotate(90deg);
            margin: 511px 0 0 280px;
        }

        .fla_four {
            transform: rotate(360deg);
            margin: 230px 0 0 402px;
        }

        .tri {
            width: 0;
            height: 0;
            border-width: 142px;
            border-style: solid;
            border-top-left-radius: 109px 122px;
            position: absolute;
            transform: rotate(45deg);
            top: 28px;
            left: 56px;
        }

        .tri_one {
            border-color: #F1C40F transparent transparent #F1C40F;
        }

        .tri_two {
            border-color: #EA4C3C transparent transparent #EA4C3C;
        }

        .tri_three {
            border-color: #2ECC71 transparent transparent #2ECC71;
        }

        .tri_four {
            border-color: #1ABC9C transparent transparent #1ABC9C;
        }

        .squ {
            position: absolute;
            width: 271px;
            height: 170px;
            border-top-right-radius: 98px 68px;
        }

        .squ_one {
            background-color: #F39C12;
        }

        .squ_two {
            background-color: #C0392B;
        }

        .squ_three {
            background-color: #27AE60;
        }

        .squ_four {
            background-color: #16A085;
        }
    </style>

    <script>
        //index.html加载时所触发的函数
        $(function () {
            // Ajax 获取文本内容
            $.ajax({
                url: '/ajax/getTexts',
                data: {},
                type: 'post',
                dataType: 'json',
                success: function (result) {
                    let htmlStr = "";
                    //获取返回JSON数据
                    $.each(result, function (index, item) {
                        htmlStr = "<span class='lead'>" + item + "（唐海清）" + "</span>"
                    });
                    $('#text').html(htmlStr);
                    $('#hideOrShowText').innerText = '隐藏文本内容';
                },
                error: function (result) {
                    console.log(result.toString());
                }
            });
        });

        //用户选择是否显示文本内容
        function hideOrShowText() {
            const hideOrShowText = $('#hideOrShowText').val();
            if (hideOrShowText === '隐藏文本内容') {
                $('#text').hide();
                $('#hideOrShowText').innerText = '显示文本内容';
            } else {
                $('#text').show();
                $('#hideOrShowText').innerText = '隐藏文本内容';
            }
        }

        $(function () {
            $.ajax({
                url: '/user/getUsers',
                data: {},
                type: 'post',
                dataType: 'json',
                success: function (result) {
                    let userId;
                    $.each(result, function (index, item) {
                        userId = item.userId;
                        console.log('userId : ' + userId);
                    })
                },
                error: function (result) {
                    console.log(result.toString());
                }
            })
        });
    </script>
</head>
<body>
<!--导航条-->
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">个人图标</a>
        </div>


        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a th:href="@{/}">首页<span class="sr-only">(current)</span></a></li>
                <li><a href="#">咸鱼广场</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">咸鱼工作<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">IT</a></li>
                        <li><a href="#">金融</a></li>
                        <li><a href="#">服务</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">销售</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">土木</a></li>
                    </ul>
                </li>
            </ul>
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <label>
                        <input type="text" class="form-control" placeholder="天安门招聘保安,熟手优先">
                    </label>
                </div>
                <button type="submit" class="btn btn-default">Get it</button>
            </form>

            <ul class="nav navbar-nav navbar-right">
                <li><a th:href="@{/ajax/toLogin}" th:if="${userName==null}">登陆</a></li>
                <li><a th:href="@{/ajax/toRegister}">注册</a></li>
                <li><a th:href="@{/ajax/exit}" th:if="${userName!=null}">注销</a></li>
                <li><a th:href="@{/user/myMessages}">待阅信息<span class="badge">42</span></a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">我的账户<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a th:href="@{/user/toMyInfo}">个人信息</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<!--文本内容 Ajax随机生成-->
<p style="margin: auto;text-align: center;color: gray" id="text" onclick="hideOrShowText()"></p>
<a id="hideOrShowText" onclick="hideOrShowText()"></a>

<!--首页Logo-->
<div class="main">
    <div class="white_circle"></div>
    <div class="fla fla_one">
        <div class="squ squ_one"></div>
        <div class="tri tri_one"></div>
    </div>
    <div class="fla fla_two">
        <div class="squ squ_two"></div>
        <div class="tri tri_two"></div>
    </div>
    <div class="fla fla_three">
        <div class="squ squ_three"></div>
        <div class="tri tri_three"></div>
    </div>
    <div class="fla fla_four">
        <div class="squ squ_four"></div>
        <div class="tri tri_four"></div>
    </div>
</div>
</body>
</html>